package com.gack.business.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.gack.business.service.StoreSupportFacityAndServiceNewServiceInterface;
import com.gack.helper.common.AjaxJson;
import com.gack.helper.common.abstractobj.ApiController;

import io.swagger.annotations.ApiOperation;

/**
 * 
* @ClassName: StoreSupportFacityAndServiceController 
* @Description: TODO(这里用一句话描述这个类的作用) 
* @author (ZhangXinYu)  
* @date 2018年9月10日 上午9:16:50 
* @version V1.0
 */
@RestController
@RequestMapping(ApiController.STORE_SUPPORT_FACITY_AND_SERVICE_URL)
public class StoreSupportFacityAndServiceController {
	@Autowired
	private StoreSupportFacityAndServiceNewServiceInterface service;
	
	@ApiOperation(value="编辑/添加门店配套设施",notes="编辑/添加门店配套设施")
	@PostMapping("editFacity")
	public AjaxJson editFacity(String backId, String id, String names, String icons, int useTemplate){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.editFacity(backId, id, names, icons, useTemplate));
		return ajaxJson;
	}
	
	@ApiOperation(value="删除门店配套设施",notes="删除门店配套设施")
	@PostMapping("deleteFacity")
	public AjaxJson deleteFacity(String backId, String id){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.deleteFacity(backId, id));
		return ajaxJson;
	}
	
	@ApiOperation(value="编辑门店配套服务",notes="编辑门店配套服务")
	@PostMapping("editService")
	public AjaxJson editService(String backId, String id, String names, String icons, int useTemplate){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.editService(backId, id, names, icons, useTemplate));
		return ajaxJson;
	}
	
	@ApiOperation(value="删除门店配套服务",notes="删除门店配套服务")
	@PostMapping("deleteService")
	public AjaxJson deleteService(String backId, String id){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.deleteService(backId, id));
		return ajaxJson;
	}
	
	@ApiOperation(value="查询所有未删除门店配套设施",notes="查询所有未删除门店配套设施")
	@PostMapping("getAllFacity")
	public AjaxJson getAllFacity(){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.getAllFacity());
		return ajaxJson;
	}
	
	@ApiOperation(value="查询所有未删除门店配套服务",notes="查询所有未删除门店配套服务")
	@PostMapping("getAllService")
	public AjaxJson getAllService(){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.getAllService());
		return ajaxJson;
	}
	
	@ApiOperation(value="查询所有未删除门店配套设施及门店配套服务",notes="查询所有未删除门店配套设施及门店配套服务")
	@PostMapping("getAllFacityAndService")
	public AjaxJson getAllFacityAndService(){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.getAllFacityAndService());
		return ajaxJson;
	}
	
	@ApiOperation(value="分页查询未删除门店配套设施",notes="分页查询未删除门店配套设施")
	@PostMapping("searchSupportFacity")
	public AjaxJson searchSupportFacity(
			@RequestParam(value="searchType",defaultValue="0")int searchType,
			String keyWord, String startTime, String endTime,
			@RequestParam(value="page",defaultValue="0")int page,
			@RequestParam(value="size",defaultValue="10")int size){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.searchSupportFacity(searchType, keyWord, startTime, endTime, page, size));
		return ajaxJson;
	}
	
	@ApiOperation(value="分页查询未删除门店配套服务",notes="分页查询未删除门店配套服务")
	@PostMapping("searchSupportService")
	public AjaxJson searchSupportService(
			@RequestParam(value="searchType",defaultValue="0")int searchType,
			String keyWord, String startTime, String endTime,
			@RequestParam(value="page",defaultValue="0")int page,
			@RequestParam(value="size",defaultValue="10")int size){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(service.searchSupportService(searchType, keyWord, startTime, endTime, page, size));
		return ajaxJson;
	}
	
}
